#求最小公倍数
def gcd(a,b):
    big=max(a,b)
    small=min(a,b)
    if big%small==0:
        return small
    return gcd(small,big%small)

def lcm(a, b):
    if a * b == 0:
        return 0
    else:
        return a * b / gcd(a, b)


# 计算周期的最小公倍数  lcm(a,b,c) = lcm(lcm(a,b),c)
lst=[[1,15],[2,30],[3,45]]
def LCM_All(lst):
    r = lcm(lst[0][1], lst[1][1])
    for i in range(2, len(lst)):
        r =lcm( r, lst[i][1])
    return r
print(gcd(2,3))
print(lcm(2,3))
print(LCM_All(lst) )